import 'package:flutter/material.dart';

class LogoApp extends StatefulWidget {
  @override
  _LogoAppState createState() => _LogoAppState();
}

class _LogoAppState extends State<LogoApp> with TickerProviderStateMixin{

  Animation<double> animation;
  AnimationController animationController;

  @override
  void initState() {
    super.initState();
    animationController =
        new AnimationController(vsync: this,
        duration: const Duration(milliseconds: 2000),
        );
    animation = Tween(begin: 0.0,end:300.0).animate(animationController)
      ..addListener((){
      setState(() {
        //状态改变
        print(animation.value);
      });

    })
    ..addStatusListener((AnimationStatus status){
      if(status == AnimationStatus.completed){
        print('动画完成');
      }
    });
    animationController.forward();
  }

  @override
  void dispose() {
    animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
       margin:EdgeInsets.symmetric(vertical: 8.0),
        height:animation.value,
        width: animation.value,
        child:FlutterLogo(),
      )
    );
  }
}
